import { http } from "@/utils/http";
import { baseUrlApi, filerEmptyVal } from "../utils";

/** 待办事项 */
export const getNewToDoList = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/index/new/todo/count"), {
    params: filerEmptyVal(params)
  });
};

/** 项目进行中 */
export const getNewDoingList = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/index/new/doing/count"), {
    params: filerEmptyVal(params)
  });
};

/** 我的科研 */
export const getNewMineResearch = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/index/new/mine/count"), {
    params: filerEmptyVal(params)
  });
};

/** 全院科研 */
export const getAllResearch = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/index/mine/count"), {
    params: filerEmptyVal(params)
  });
};

/** 个人年度积分排名 */
export const getNewPersonYearScoreList = (params?: object) => {
  return http.request<any>(
    "get",
    baseUrlApi("/index/new/user/score/range/page/year"),
    {
      params: filerEmptyVal(params)
    }
  );
};

/** 团队年度积分排名列表 */
export const getNewTeamScoreList = (params?: object) => {
  return http.request<any>(
    "get",
    baseUrlApi("/index/new/team/score/range/pageByYear"),
    {
      params: filerEmptyVal(params)
    }
  );
};

/** 个人月度积分增长最快列表 */
export const getNewPersonMonthScoreList = (params?: object) => {
  return http.request<any>(
    "get",
    baseUrlApi("/index/new/user/score/range/page"),
    {
      params: filerEmptyVal(params)
    }
  );
};

/** 团队月度积分增长最快列表 */
export const getNewTeamYdjfRange = (params?: object) => {
  return http.request<any>(
    "get",
    baseUrlApi("/index/new/team/score/range/pageByMonth"),
    {
      params: filerEmptyVal(params)
    }
  );
};

// =========
/** 添加典型成果 */
export const addToatlAchiev = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/index/add"), { data });
};

/** 删除典型成果 */
export const delToatlAchiev = (id?: number) => {
  return http.request<any>("post", baseUrlApi("/index/delete?id=" + id));
};

/** 典型成果列表 */
export const getTotalAchiev = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/index/page"), {
    params: filerEmptyVal(params)
  });
};
